
$(document).ready(function() {
    $("#CategoryType").change(function() {
        var value = $(this).val();
        //var url = "<?php echo Router::url(array('controller' => 'categories', 'action' => 'jQueryGetPcat')); ?>";
        $.ajax({
            type: 'post',
            url: "http://localhost/money/categories/jQueryGetPcat",
            data: {value: value},
            dataType: 'json',
            timeout: 10000,
            error: function(xhr, status, error) {
                alert('Error: ' + xhr.status + ' - ' + error);
            },
            success: function(response) {
               
                $("#CategoryParentId").html('');
                for (var key in response) {
                    $("#CategoryParentId").append('<option value=' + key + '>' + response[key] + '</option>');
                }
            }
        });
        return false;
    });
});